module(
    name = "test_projects",
    version = "1.0",
)

bazel_dep(
    name = "rules_jvm_external",
    version = "6.7",
)

maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.install(
    artifacts = [
        "com.google.guava:guava:32.1.2-jre",
    ],
    repositories = [
        # "file://m2", # <-- Replaced by the test framework.
    ],
)
use_repo(maven, "maven")

maven.install(
    name = "rules_compose_maven",
    aar_import_bzl_label = "@rules_android//rules:rules.bzl",
    artifacts = [
        "androidx.activity:activity:1.10.1",
        "androidx.activity:activity-compose:1.10.1",
        "androidx.activity:activity-ktx:1.10.1",
        "androidx.collection:collection:1.5.0-alpha06",
        "androidx.collection:collection-ktx:1.5.0-alpha06",
        "androidx.compose.foundation:foundation-layout",
        "androidx.compose.material3:material3",
        "androidx.compose.runtime:runtime",
        "androidx.compose.ui:ui",
        "androidx.compose.ui:ui-tooling",
        "androidx.core:core:1.16.0",
        "androidx.core:core-ktx:1.16.0",
        "androidx.lifecycle:lifecycle-common:2.8.7",
        "androidx.lifecycle:lifecycle-common-java8:2.8.7",
        "androidx.lifecycle:lifecycle-common-jvm:2.8.7",
        "androidx.lifecycle:lifecycle-compiler:2.8.7",
        "androidx.lifecycle:lifecycle-livedata:2.8.7",
        "androidx.lifecycle:lifecycle-livedata-core:2.8.7",
        "androidx.lifecycle:lifecycle-livedata-core-ktx:2.8.7",
        "androidx.lifecycle:lifecycle-livedata-ktx:2.8.7",
        "androidx.lifecycle:lifecycle-process:2.8.7",
        "androidx.lifecycle:lifecycle-reactivestreams:2.8.7",
        "androidx.lifecycle:lifecycle-reactivestreams-ktx:2.8.7",
        "androidx.lifecycle:lifecycle-runtime:2.8.7",
        "androidx.lifecycle:lifecycle-runtime-compose:2.8.7",
        "androidx.lifecycle:lifecycle-runtime-ktx:2.8.7",
        "androidx.lifecycle:lifecycle-service:2.8.7",
        "androidx.lifecycle:lifecycle-viewmodel:2.8.7",
        "androidx.lifecycle:lifecycle-viewmodel-compose:2.8.7",
        "androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.7",
        "androidx.lifecycle:lifecycle-viewmodel-savedstate:2.8.7",
        "org.jetbrains.kotlin:kotlin-compose-compiler-plugin-embeddable:2.1.0",
    ],
    boms = [
        "androidx.compose:compose-bom:2024.09.00",
    ],
    repositories = [
        # "file://m2", # <-- Replaced by the test framework.
        "https://maven.google.com",
        "https://mvnrepository.com/artifact",
        "https://repo1.maven.org/maven2",
    ],
    use_starlark_android_rules = True,
)
use_repo(maven, "rules_compose_maven")

# This is a copy of the list from th rules_android repository but artifacts are fetched from a local repository.
maven.install(
    name = "rules_android_maven",
    aar_import_bzl_label = "@rules_android//rules:rules.bzl",
    artifacts = [
        "androidx.privacysandbox.tools:tools:1.0.0-alpha06",
        "androidx.privacysandbox.tools:tools-apigenerator:1.0.0-alpha06",
        "androidx.privacysandbox.tools:tools-apipackager:1.0.0-alpha06",
        "androidx.privacysandbox.tools:tools-core:1.0.0-alpha06",
        "androidx.test:core:1.6.0-alpha01",
        "androidx.test.ext:junit:1.2.0-alpha01",
        "com.android.tools.apkdeployer:apkdeployer:8.8.0-alpha05",
        "org.gradle:gradle-core:4.2.1",
        "com.android.tools.build:bundletool:1.15.5",
        "com.android.tools:desugar_jdk_libs_minimal:2.0.4",
        "com.android.tools:desugar_jdk_libs_configuration_minimal:2.0.4",
        "com.android.tools:desugar_jdk_libs_nio:2.0.4",
        "com.android.tools:desugar_jdk_libs_configuration_nio:2.0.4",
        "com.android.tools.build:gradle:8.7.0",
        "com.android.tools:r8:8.5.35",
        "org.bouncycastle:bcprov-jdk18on:1.77",
        "org.hamcrest:hamcrest-core:2.2",
        "org.robolectric:robolectric:4.14.1",
        "com.google.flogger:flogger:0.8",
        "com.google.guava:guava:32.1.2-jre",
        "com.google.truth:truth:1.1.5",
        "info.picocli:picocli:4.7.4",
        "jakarta.inject:jakarta.inject-api:2.0.1",
        "junit:junit:4.13.2",
        "com.beust:jcommander:1.82",
        "com.google.protobuf:protobuf-java:4.29.3",
        "com.google.protobuf:protobuf-java-util:4.29.3",
        "com.google.code.findbugs:jsr305:3.0.2",
        "androidx.databinding:databinding-compiler:8.7.0",
        "org.ow2.asm:asm:9.6",
        "org.ow2.asm:asm-commons:9.6",
        "org.ow2.asm:asm-tree:9.6",
        "org.ow2.asm:asm-util:9.6",
        "com.android.tools.layoutlib:layoutlib-api:30.1.3",
        "com.android:zipflinger:8.7.0",
        "com.android.tools.build:manifest-merger:30.1.3",
        "com.android:signflinger:8.7.0",
        "com.android.tools.build:aapt2-proto:8.6.1-11315950",
        "com.android.tools.analytics-library:protos:30.1.3",
        "com.android.tools.analytics-library:shared:30.1.3",
        "com.android.tools.analytics-library:tracker:30.1.3",
        "com.android.tools:annotations:30.1.3",
        "com.android.tools.build:apksig:8.7.0",
        "com.android.tools.build:apkzlib:8.7.0",
        "com.android.tools.build:builder:8.7.0",
        "com.android.tools.build:builder-model:8.7.0",
        "com.google.auto.value:auto-value:1.11.0",
        "com.google.auto.value:auto-value-annotations:1.11.0",
        "com.google.auto:auto-common:1.2.2",
        "com.google.auto.service:auto-service:1.1.1",
        "com.google.auto.service:auto-service-annotations:1.1.1",
        "com.google.errorprone:error_prone_annotations:2.33.0",
        "com.google.errorprone:error_prone_type_annotations:2.33.0",
        "com.google.errorprone:error_prone_check_api:2.33.0",
        "com.google.errorprone:error_prone_core:2.33.0",
    ],
    repositories = [
        # "file://m2", # <-- Replaced by the test framework.
    ],
    use_starlark_android_rules = True,
)
use_repo(
    maven,
    "rules_android_maven",
)

bazel_dep(
    name = "rules_pkg",
    version = "1.1.0",
)
bazel_dep(
    name = "rules_kotlin",
    version = "2.1.3",
)
single_version_override(
    module_name = "rules_kotlin",
    patch_strip = 1,
    patches = ["//:rules_kotlin.patch"],
)  # seems to be an known issue, follow https://yaqs.corp.google.com/eng/q/4684749665604730880#a1n3 to bypass it

bazel_dep(
    name = "rules_java",
    version = "8.11.0",
)
bazel_dep(
    name = "rules_cc",
    version = "0.1.1",
)
bazel_dep(
    name = "platforms",
    version = "0.0.11",
)
bazel_dep(
    name = "rules_proto",
    version = "7.1.0",
)
bazel_dep(
    name = "rules_go",
    version = "0.53.0",
)
bazel_dep(
    name = "gazelle",
    version = "0.40.0",
)

go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")

# Prevent rules_go from attempting to fetch them form the net.
go_sdk.download(
    name = "go_sdk",
    goarch = "amd64",
    goos = "linux",
    sdks = {
        "linux_amd64": ("go1.22.4.linux-amd64.tar.gz", "ba79d4526102575196273416239cca418a651e049c2b099f3159db85e7bade7d"),
    },
    version = "1.22.4",
)
use_repo(go_sdk, "go_sdk")

go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")

# Prevent gazelle from attempting to fetch them as git repositories from the net.
go_deps.archive_override(
    path = "golang.org/x/sync",
    sha256 = "1872b89e8bf234d4c65edca0bf7c7fd6c414cf74a5a9e10463eb2483cf7b361f",
    strip_prefix = "sync-0.8.0",
    urls = ["https://github.com/golang/sync/archive/refs/tags/v0.8.0.tar.gz"],
)
go_deps.archive_override(
    path = "github.com/golang/protobuf",
    sha256 = "d75e6960ecfabaaa83a7261b1b630d24e9c63aca79615fb15bf33e11b62fd019",
    strip_prefix = "protobuf-1.5.4",
    urls = ["https://github.com/golang/protobuf/archive/refs/tags/v1.5.4.tar.gz"],
)
go_deps.archive_override(
    path = "google.golang.org/protobuf",
    sha256 = "d15b5c42786fa47d716b1572e5ba21979dc3163121854ece5101f072d4fa95bb",
    strip_prefix = "protobuf-go-1.36.3",
    urls = ["https://github.com/protocolbuffers/protobuf-go/archive/refs/tags/v1.36.3.tar.gz"],
)
go_deps.archive_override(
    path = "bitbucket.org/creachadair/stringset",
    sha256 = "c53d3526e766cd95c24e6e59c2e3f141c2001382f2eaab338a50e8cf8f8aa76c",
    strip_prefix = "creachadair-stringset-344423ca2481",
    urls = ["https://bitbucket.org/creachadair/stringset/get/344423ca24817f0ff8371b5b6ad96f9848a5c109.tar.gz"],
)

bazel_dep(
    name = "protobuf",
    version = "29.3",
)
bazel_dep(
    name = "apple_support",
    version = "1.20.0",
    repo_name = "build_bazel_apple_support",
)
bazel_dep(
    name = "rules_android",
    version = "0.6.4",
)
bazel_dep(
    name = "bazel_skylib",
    version = "1.7.1",
)
bazel_dep(
    name = "rules_testing",
    version = "0.8.0",
    dev_dependency=True
)

remote_android_extensions = use_extension(
    "@rules_android//bzlmod_extensions:android_extensions.bzl",
    "remote_android_tools_extensions",
)
use_repo(remote_android_extensions, "android_gmaven_r8", "android_tools")

register_toolchains("@androidsdk//:sdk-toolchain", "@androidsdk//:all")

android_sdk_repository_extension = use_extension(
    "@rules_android//rules/android_sdk_repository:rule.bzl",
    "android_sdk_repository_extension",
)
use_repo(android_sdk_repository_extension, "androidsdk")
